package com.multysite.controller.me;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


import com.google.appengine.api.NamespaceManager;
import com.multysite.entity.News;
import com.multysite.model.NewsModel;


@SuppressWarnings("serial")
public class TestServlet extends HttpServlet {
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		NamespaceManager.set(req.getParameter("ns"));
		News obj = new News();
		obj.setAlias("syria-conflict");
		obj.setCategory("News");
		obj.setCategoryAlias("news");
		obj.setContent("The Middle East faces a humanitarian crisis caused by the conflict in Syria, an aid agency says.");
		obj.setSource("http://www.bbc.co.uk/news/world-middle-east-21007519");
		obj.setThumb("http://news.bbcimg.co.uk/media/images/65191000/jpg/_65191548_best_pic_composite.jpg");
		obj.setTitle("Syria conflict causing 'staggering' humanitarian crisis");
		NewsModel.insert(obj);
		obj = new News();
		obj.setAlias("swept-away");
		obj.setCategory("News");
		obj.setCategoryAlias("news");
		obj.setContent("Italian actress Mariangela Melato, best known for her role in the 1974 comedy Swept Away, has died aged 71.");
		obj.setSource("http://www.bbc.co.uk/news/entertainment-arts-20986852");
		obj.setThumb("http://news.bbcimg.co.uk/media/images/65227000/jpg/_65227843_0buxwwtd.jpg");
		obj.setTitle("Swept Away actress Mariangela Melato dies aged 71");
		NewsModel.insert(obj);
		obj = new News();
		obj.setAlias("david-bowie");
		obj.setCategory("News");
		obj.setCategoryAlias("news");
		obj.setContent("Where Are We Now?, David Bowie's first new song in a decade, has reached the Top 10 in this week's UK singles chart.");
		obj.setSource("http://www.bbc.co.uk/news/world-middle-east-21007519");
		obj.setThumb("http://news.bbcimg.co.uk/media/images/65256000/jpg/_65256186_d9077294-3bd3-4570-bac3-367b9305af10.jpg");
		obj.setTitle("David Bowie comeback makes Top 10 singles chart");
		NewsModel.insert(obj);
	}
}
